package edu.sctu.wujiayi.month06.day20150616.InterNet;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

/**
 * Created by user11 on 2015/6/16.
 */
public class UrlTestOne {

    public String UrlTesttwo(String path){
        byte by[] = new byte[1024];
        int count = 0;
        try {
            URL url = new URL(path);

            try {

                InputStream inputStream = url.openStream();
                url.getContent();
                url.openConnection();

                while ((count = inputStream.read(by))!=-1){
                    System.out.println(new String(by,0,count, "Utf-8"));
                }
            } catch (IOException e) {
                e.printStackTrace();
            }


        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    return path;

    }




}





